
#ifndef PARSER_H
#define	PARSER_H

#include "buffer.h"
#include "database.h"
#include "packets.h"
#include "network.h"

#include "sqlite3.h"

class parser: public network
{
public:
    parser(char *ip);
    ~parser();
    
private:

    buffer buf;
    database db;

    void getstr(char *&packet, char *str);

    bool Parse(int socket, LList_socks_t *socks, char *data, int datalen);

    void plogin(char *packet, LList_socks_t *socks);
    void pgetalljobs(char *packet, int permissions);
    void pgetjob(char *packet, int permissions);
    void psubmitapp(char *packet, int permissions);
    void peditjob(char *packet, int permissions);
    void pdeletejob(char *packet, int permissions);
    void pgetallapp(char *packet, int permissions);
    void pgetapplication(char *packet, int permissions);
    void pgetreviewrating(char *packet, int permissions);
    void paddreviewer(char *packet, int permissions);
    void pdeletereviewer(char *packet, int permissions);
    void pgetallreviewers(char *packet, int permissions);
    void pgetreviewer(char *packet, int permissions);
    void peditrevieweraccount(char *packet, int permissions);
    void pdeleterevieweraccount(char *packet, int permissions);

    void pgetrating(char *packet, int permissions, char *username);
    void psendrating(char *packet, int permissions, char *username);
    void pgetreviewallapps(char *packet, int permissions, char *username);
    void pgetreviewapp(char *packet, int permissions);

    void prequestapp(char *packet, int permissions, char *username);
    void psendreference(char *packet, int permissions, char *username);

    void pgetaccounts(char *packet, int permissions);
    void pgetaccount(char *packet, int permissions);
    void peditaccount(char *packet, int permissions);
    void pdeleteaccount(char *packet, int permissions);
};

#endif

